@extends('layouts.master')

@section('content')
    <div class="row">
        <div class="col-sm-12">
            <section class="panel">
                <header class="panel-heading">
                    {{ $title }}
                    <span class="tools pull-right">
                     </span>
                </header>
                <div class="panel-body minimal">
                    <div class="mail-option">
                        {!!  Form::open([
                        'url'       => $url,
                        'method'    => 'get',
                        ]) !!}

                        <div class="col-md-12 col-sm-12">
                            <div class="btn-group" style="width: 270px;">
                                <div class="input-group input-sm">
                                    <input type="text" class="form-control datepicker" name="from" autocomplete="off">
                                    <span class="input-group-addon">至</span>
                                    <input type="text" class="form-control datepicker" name="to" autocomplete="off">
                                </div>
                            </div>
                            {!! $filters !!}
                            <div class="btn-group">
                                <button type="submit" class="btn btn-success">查询</button>
                                <a href="{{$url . '?' . http_build_query(array_merge(\Input::except('p'), ['export' => 'xls'])) }}" class="btn btn-danger" type="button">导出</a>
                            </div>
                        </div>
                        {!!  Form::close() !!}
                    </div>

                    <div class="table-inbox-wrap">
                        <table class="table" id="users-table">
                            <thead class="hidden-xs">
                            <tr class="row">
                                <th></th>
                                @foreach ($columns as $key => $name)
                                    <th>{{ is_array($name) ? $name[0]: $name }}</th>
                                @endforeach
                            </tr>
                            </thead>
                            <tbody class="icheck_list">
                            @foreach ($items as $item)
                                <tr class="row">
                                    <td></td>
                                    @foreach($columns as $column => $name)
                                        <td>
                                            {{ array_get($item, $column, '') }}
                                        </td>
                                    @endforeach
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>

                    <div class="row">
                        <div class="col-md-8 col-sm-12 col-md-offset-4" >
                            <div class="btn-group pull-right">{!!  $paginate->appends(\Input::except('page'))->render()  !!}</div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
@stop